//
//  categoryModel.m
//  xiaorizi
//
//  Created by kun on 15/10/26.
//  Copyright © 2015年 origin. All rights reserved.
//

#import "categoryModel.h"

@implementation CategoryModel

+(CategoryModel *)initWithDic:(NSDictionary *)dic
{
    return [[self alloc]initWithDic:dic];
}



-(CategoryModel *)initWithDic:(NSDictionary *)dic
{
    
    if(self =  [super init])
    {
        self.title = dic[@"title"];
        
        //解析分类数据
        NSArray *dataArray = dic[@"tags"];
        NSMutableArray *dataM = [NSMutableArray array];
        for(NSDictionary *dic in dataArray)
        {
            CategoryEventModel *model = [CategoryEventModel initWithDic:dic];
            [dataM addObject:model];
        }
        self.tags = dataM;
    }
    
    return self;
}

@end

@implementation CategoryEventModel


+(CategoryEventModel *)initWithDic:(NSDictionary *)dic
{
    return [[self alloc]initWithDic:dic];
}



-(CategoryEventModel *)initWithDic:(NSDictionary *)dic
{
    
    if(self =  [super init])
    {
        self.name = dic[@"name"];
        self.img = dic[@"img"];
        self.keywords = dic[@"keywords"];
        self.ID = dic[@"id"];
        self.ev_count = dic[@"ev_count"];
    }
    
    return self;
}




@end


